import numpy as np

# algorithm: ['MID', 'EDF', 'INS', 'SRPT', 'FB', 'THR', 'OPTFB', 'RM', 'SEDF', 'SALL', 'FIFO', 'FEDF']
def GetAveMiss():
    ave_miss_ddl0 = [1033.96, 117.72, 106.84, 956.0, 126.24, 126.24, 132.52, 368.02, 173.36, 1011.92, 3782.3, 3779.78]
    ave_miss_ddl1 = [1278.14, 173.92, 155.9, 973.86, 185.66, 185.66, 170.68, 278.72, 177.88, 877.98, 3444.94, 3412.34]
    ave_miss_ddl2 = [1282.22, 663.42, 565.84, 684.44, 544.22, 544.22, 501.64, 1086.66, 522.18, 682.7, 1923.46, 1911.58]
    ave_miss_ddl3 = [902.82, 81.36, 31.72, 559.58, 100.42, 100.5, 56.78, 257.34, 58.08, 592.88, 2482.1, 2482.56]
    ave_miss_ddl4 = [643.04, 550.6, 284.96, 477.84, 293.26, 293.26, 251.62, 1301.0, 252.42, 664.14, 2541.12, 2541.12]
    ave_miss_ddl5 = [1173.26, 370.02, 275.44, 552.68, 300.08, 302.34, 274.64, 899.18, 291.86, 694.1, 1316.06, 1316.06]
    ave_miss_ddl6 = [1130.1, 470.94, 447.22, 441.36, 433.2, 433.32, 427.34, 1093.14, 427.28, 471.66, 1145.98, 1145.98]
    ave_miss_ddl7 = [1115.48, 615.18, 614.42, 680.96, 609.54, 609.26, 610.52, 1341.46, 623.86, 779.22, 1539.82, 1539.82]
    ave_miss_ddl8 = [1228.96, 668.02, 660.54, 766.04, 659.1, 659.1, 659.1, 1003.96, 702.3, 705.26, 3188.08, 3124.4]
    ave_miss_ddl9 = [1188.16, 308.74, 213.74, 442.5, 211.28, 210.96, 190.4, 754.66, 228.7, 468.46, 2347.76, 2326.34]
    
    total_data = []
    total_data.append(ave_miss_ddl0)
    total_data.append(ave_miss_ddl1)
    total_data.append(ave_miss_ddl2)
    total_data.append(ave_miss_ddl3)
    total_data.append(ave_miss_ddl4)
    total_data.append(ave_miss_ddl5)
    total_data.append(ave_miss_ddl6)
    total_data.append(ave_miss_ddl7)
    total_data.append(ave_miss_ddl8)
    total_data.append(ave_miss_ddl9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Ave miss count",np_total_data.mean(axis = 0))    

# algorithm: ['MID', 'EDF', 'INS', 'SRPT', 'FB', 'THR', 'OPTFB', 'RM', 'SEDF', 'SALL', 'FIFO', 'FEDF']
def GetWorstMiss():
    worst_miss_ddl0 = [1179, 183, 121, 1233, 164, 164, 181, 449, 255, 1207, 3948, 3948]
    worst_miss_ddl1 = [1348, 188, 180, 1024, 205, 205, 191, 294, 198, 930, 3469, 3443]
    worst_miss_ddl2 = [1520, 893, 822, 844, 721, 721, 688, 1129, 716, 770, 2163, 2163]
    worst_miss_ddl3 = [907, 87, 35, 572, 108, 108, 66, 259, 68, 603, 2511, 2511]
    worst_miss_ddl4 = [651, 561, 293, 486, 304, 304, 260, 1307, 261, 676, 2571, 2571]
    worst_miss_ddl5 = [1187, 387, 288, 569, 318, 317, 290, 926, 309, 704, 1337, 1337]
    worst_miss_ddl6 = [1152, 486, 461, 467, 446, 446, 444, 1130, 444, 487, 1161, 1161]
    worst_miss_ddl7 = [1197, 713, 694, 770, 696, 696, 691, 1514, 704, 834, 1634, 1634]
    worst_miss_ddl8 = [1346, 684, 683, 788, 669, 669, 669, 1126, 723, 725, 3257, 3207]
    worst_miss_ddl9 = [1225, 331, 229, 458, 235, 235, 209, 803, 247, 492, 2403, 2380]
    
    total_data = []
    total_data.append(worst_miss_ddl0)
    total_data.append(worst_miss_ddl1)
    total_data.append(worst_miss_ddl2)
    total_data.append(worst_miss_ddl3)
    total_data.append(worst_miss_ddl4)
    total_data.append(worst_miss_ddl5)
    total_data.append(worst_miss_ddl6)
    total_data.append(worst_miss_ddl7)
    total_data.append(worst_miss_ddl8)
    total_data.append(worst_miss_ddl9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Worst miss count",np_total_data.max(axis = 0))

# algorithm: ['MID', 'EDF', 'INS', 'SRPT', 'FB', 'THR', 'OPTFB', 'RM', 'SEDF', 'SALL', 'FIFO', 'FEDF']
def GetAveCR():
    ave_cr0 = [0.8265522917647484, 0.980252468812955, 0.9820775004917054, 0.8396306043319458, 0.9788232819694158, 0.9788232819694158, 0.9777697877034235, 0.9382645597252832, 0.9709189443674886, 0.8302501421740448, 0.3655157285281486, 0.36593847358397097]
    ave_cr1 = [0.7955186539989486, 0.9721756112288037, 0.9750584984719075, 0.8441982216268523, 0.9702974472045391, 0.9702974472045391, 0.9726939707920249, 0.9554093853954092, 0.9715420987627035, 0.8595374711592848, 0.44886601552629296, 0.4540814811272056]
    ave_cr2 = [0.7978425141010972, 0.8954041910615047, 0.9107883271530585, 0.8920900660301321, 0.9141974667170055, 0.9141974667170055, 0.9209106581024377, 0.8286750475301631, 0.9176723502109876, 0.8923642593788409, 0.696743152059281, 0.6986161952327195]
    ave_cr3 = [0.7764323320446002, 0.9798526261870666, 0.9921451040480338, 0.8614297736859432, 0.9751327152501925, 0.9751129083673007, 0.9859394708269289, 0.9362742180803927, 0.9856175219182627, 0.853183624344755, 0.38535126258789576, 0.385237344806816]
    ave_cr4 = [0.8720028398141417, 0.8904029948898912, 0.9432786953936813, 0.9048858644668853, 0.9416265642617491, 0.9416265642617491, 0.9499150282804846, 0.741035798021584, 0.9497557941913973, 0.8678028681838025, 0.4941896787986099, 0.4941896787986099]
    ave_cr5 = [0.7154271492825481, 0.91025205053722, 0.9331923760727234, 0.8659481144598047, 0.9272159814321812, 0.9266678097944875, 0.933386446017955, 0.781904952769693, 0.9292097342422778, 0.8316468276584268, 0.6807911888460729, 0.6807911888460729]
    ave_cr6 = [0.7256172595600472, 0.8856581102475849, 0.8914171257073252, 0.8928399343812733, 0.8948211710978226, 0.8947920307384247, 0.896243946758593, 0.7345910871988877, 0.8962585169382917, 0.8854832928609523, 0.721761711885872, 0.721761711885872]
    ave_cr7 = [0.7463215224944705, 0.8600980234630528, 0.8602708923913726, 0.8451386216286814, 0.8613807006993193, 0.8614443804809886, 0.8611578276669917, 0.6949304313838434, 0.8581241312088679, 0.8227925139513798, 0.6498198182252068, 0.6498198182252068]
    ave_cr8 = [0.7912310889288783, 0.8865204855276513, 0.8877911071777125, 0.8698694217285912, 0.8880357318287802, 0.8880357318287802, 0.8880357318287802, 0.8294528477825769, 0.8806971716291799, 0.8801943417228998, 0.45842639749537895, 0.46924405761245097]
    ave_cr9 = [0.7613504870839791, 0.9379875196821027, 0.957068882397516, 0.9111210963128363, 0.9575630091678471, 0.9576272791015686, 0.9617568774266522, 0.8484218536718678, 0.9540640837962107, 0.9059068863497651, 0.528437322480437, 0.532739682567898]
    
    total_data = []
    total_data.append(ave_cr0)
    total_data.append(ave_cr1)
    total_data.append(ave_cr2)
    total_data.append(ave_cr3)
    total_data.append(ave_cr4)
    total_data.append(ave_cr5)
    total_data.append(ave_cr6)
    total_data.append(ave_cr7)
    total_data.append(ave_cr8)
    total_data.append(ave_cr9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Ave CR",np_total_data.mean(axis = 0)) 


# algorithm: ['MID', 'EDF', 'INS', 'SRPT', 'FB', 'THR', 'OPTFB', 'RM', 'SEDF', 'SALL', 'FIFO', 'FEDF']
def GetAveUsys():
    ave_us0 = [0.7579864000000004, 0.8808456000000001, 0.8815849999999998, 0.7696546000000004, 0.8799038, 0.8799038, 0.8791284, 0.8565044000000002, 0.8711182, 0.7657729999999999, 0.39288760000000017, 0.39087799999999995]
    ave_us1 = [0.7431623999999999, 0.8624654000000003, 0.8771357999999999, 0.7771982000000002, 0.8676079999999999, 0.8676079999999999, 0.8751396000000001, 0.8646974000000001, 0.8755368000000001, 0.7882542000000002, 0.45572219999999986, 0.45896080000000006]
    ave_us2 = [0.73807, 0.7539292000000001, 0.823638, 0.8070065999999998, 0.7942980000000003, 0.7942980000000003, 0.8283179999999998, 0.6678254000000001, 0.8280392000000002, 0.7547375999999999, 0.6644099999999998, 0.6641756000000001]
    ave_us3 = [0.7161634000000002, 0.8809191999999999, 0.8931114000000001, 0.7718346000000001, 0.8768362000000001, 0.87682, 0.8874591999999999, 0.8683315999999998, 0.8874038, 0.7569433999999999, 0.33369020000000005, 0.33363460000000006]
    ave_us4 = [0.7828938000000001, 0.7794775999999999, 0.8477137999999997, 0.8000318, 0.8406368000000001, 0.8406368000000001, 0.8510090000000001, 0.7817553999999999, 0.8519276000000002, 0.7497684, 0.4458261999999999, 0.44564620000000005]
    ave_us5 = [0.6353108, 0.8110181999999998, 0.8380612000000001, 0.772955, 0.8294002000000001, 0.8288813999999998, 0.8365178, 0.7440872000000001, 0.8402465999999998, 0.7233977999999999, 0.5996805999999999, 0.5996805999999999]
    ave_us6 = [0.6503260000000002, 0.7878597999999998, 0.7948477999999995, 0.7953206000000002, 0.7955968, 0.7955781999999999, 0.8011252, 0.7068346, 0.8020130000000002, 0.7834008000000001, 0.6332998000000001, 0.6332998000000001]
    ave_us7 = [0.6249911999999999, 0.7350532000000001, 0.7310693999999998, 0.7566842, 0.7511264000000004, 0.7512654000000005, 0.7560472000000003, 0.6724043999999999, 0.7730435999999998, 0.6675522, 0.542668, 0.542668]
    ave_us8 = [0.691095, 0.7613664, 0.7943614, 0.7619294000000001, 0.7813666, 0.7813666, 0.7813666, 0.7428001999999997, 0.7859546000000001, 0.7614854000000001, 0.4888821999999999, 0.49346140000000005]
    ave_us9 = [0.6638588000000002, 0.8251368000000001, 0.8491371999999998, 0.7917992000000003, 0.8483947999999999, 0.8484798000000001, 0.8509982, 0.8082733999999998, 0.841993, 0.7828768000000003, 0.5243624, 0.5222354]
    
    total_data = []
    total_data.append(ave_us0)
    total_data.append(ave_us1)
    total_data.append(ave_us2)
    total_data.append(ave_us3)
    total_data.append(ave_us4)
    total_data.append(ave_us5)
    total_data.append(ave_us6)
    total_data.append(ave_us7)
    total_data.append(ave_us8)
    total_data.append(ave_us9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Ave Usys",np_total_data.mean(axis = 0)) 

def GetWorstUsys():
    worst_us0 = [0.73879, 0.87426, 0.87974, 0.7367, 0.87438, 0.87438, 0.87144, 0.84824, 0.862, 0.73856, 0.3734, 0.3722]
    worst_us1 = [0.73218, 0.86071, 0.8748, 0.7711, 0.86581, 0.86581, 0.87317, 0.86319, 0.87331, 0.78191, 0.45269, 0.45509]
    worst_us2 = [0.70614, 0.68821, 0.79029, 0.77576, 0.74779, 0.74779, 0.80421, 0.65365, 0.8028, 0.73308, 0.58183, 0.58183]
    worst_us3 = [0.71506, 0.87971, 0.89236, 0.76924, 0.87424, 0.87424, 0.88553, 0.86768, 0.88537, 0.75436, 0.32926, 0.32926]
    worst_us4 = [0.78177, 0.77579, 0.84562, 0.79834, 0.83687, 0.83687, 0.84817, 0.78079, 0.84911, 0.74789, 0.4425, 0.44226]
    worst_us5 = [0.63248, 0.80625, 0.83589, 0.77002, 0.82593, 0.82594, 0.83338, 0.73941, 0.83732, 0.72101, 0.59584, 0.59584]
    worst_us6 = [0.64629, 0.78388, 0.79133, 0.78971, 0.79206, 0.79206, 0.79687, 0.70173, 0.79878, 0.77966, 0.62991, 0.62991]
    worst_us7 = [0.60993, 0.71459, 0.69911, 0.73227, 0.72979, 0.72979, 0.73487, 0.64407, 0.74802, 0.65112, 0.52422, 0.52422]
    worst_us8 = [0.67859, 0.75865, 0.79158, 0.75709, 0.77877, 0.77877, 0.77877, 0.73733, 0.7826, 0.75761, 0.47935, 0.48341]
    worst_us9 = [0.65766, 0.81873, 0.84506, 0.78882, 0.84413, 0.84413, 0.8469, 0.80431, 0.83651, 0.77817, 0.5182, 0.51595]
    
    total_data = []
    total_data.append(worst_us0)
    total_data.append(worst_us1)
    total_data.append(worst_us2)
    total_data.append(worst_us3)
    total_data.append(worst_us4)
    total_data.append(worst_us5)
    total_data.append(worst_us6)
    total_data.append(worst_us7)
    total_data.append(worst_us8)
    total_data.append(worst_us9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Worst Usys",np_total_data.min(axis = 0)) 


# algorithm: ['MID', 'EDF', 'INS', 'SRPT', 'FB', 'THR', 'OPTFB', 'RM', 'SEDF', 'SALL', 'FIFO', 'FEDF']
def GetAveCompRatio():
    ave_CompRatio0 = [0.840153402793172, 0.9763307470627355, 0.9771502992684548, 0.853086455331412, 0.9752868543560186, 0.9752868543560186, 0.9744273996896474, 0.9493509199733984, 0.965548880514298, 0.8487840833518067, 0.43547727776546225, 0.43324983373974746]
    ave_CompRatio1 = [0.8289504857726071, 0.9620254096440642, 0.9783893096563339, 0.8669152602871134, 0.9677616535231063, 0.9677616535231063, 0.9761626752629639, 0.9645150639702844, 0.9766057266511248, 0.8792475265195031, 0.5083291876275781, 0.5119416403609552]
    ave_CompRatio2 = [0.828575277568845, 0.8463792000179622, 0.9246359890880922, 0.9059651761958755, 0.8916981936975873, 0.8916981936975873, 0.9298898705614242, 0.7497169864274731, 0.9295768829215174, 0.847286729458783, 0.7458827755761868, 0.7456196324528218]
    ave_CompRatio3 = [0.7961971361230934, 0.9793649664250457, 0.9929196869302264, 0.858089785209232, 0.9748256770578556, 0.9748076666518432, 0.9866358340374437, 0.9653706586027484, 0.9865742428958956, 0.8415344421221151, 0.3709812336016365, 0.3709194201093965]
    ave_CompRatio4 = [0.8690998101708461, 0.8653074455212533, 0.9410572706786113, 0.8881249098033992, 0.9332010079817056, 0.9332010079817056, 0.944715311774958, 0.8678360586583186, 0.9457350606676214, 0.832326905784794, 0.49491701912722996, 0.4947171989653754]
    ave_CompRatio5 = [0.7083960170823903, 0.904316537136358, 0.9344705239566028, 0.8618746027675257, 0.9248131752952063, 0.9242346933086538, 0.9327495734977644, 0.8296858936476253, 0.9369073291482221, 0.8066164155971589, 0.6686669714438633, 0.6686669714438633]
    ave_CompRatio6 = [0.7311798700276586, 0.8858130017314655, 0.8936698072901443, 0.8942013896696724, 0.8945119291223493, 0.8944910166175708, 0.9007276652200309, 0.7947140833352071, 0.9017258438083247, 0.8807996222257204, 0.7120368329922875, 0.7120368329922875]
    ave_CompRatio7 = [0.7041202316306528, 0.828116986998941, 0.8236288051193084, 0.8524866496924355, 0.8462251864536627, 0.8463817849980848, 0.8517690002478538, 0.7575363331155224, 0.8709172844235149, 0.7520698046461325, 0.6113742367229222, 0.6113742367229222]
    ave_CompRatio8 = [0.7645025332418858, 0.8422381026128898, 0.8787378039337154, 0.8428609040023011, 0.8643627071395384, 0.8643627071395384, 0.8643627071395384, 0.8216998163676186, 0.8694380406646164, 0.8423697426934221, 0.5408108586473153, 0.5458764574437486]
    ave_CompRatio9 = [0.7441528976572136, 0.9249375630534691, 0.9518408250196171, 0.8875677614617195, 0.9510086313193582, 0.951103912117475, 0.9539269140230918, 0.9060345252774356, 0.9438325299854278, 0.877566192130927, 0.5877843291110861, 0.585400067257034]
    
    total_data = []
    total_data.append(ave_CompRatio0)
    total_data.append(ave_CompRatio1)
    total_data.append(ave_CompRatio2)
    total_data.append(ave_CompRatio3)
    total_data.append(ave_CompRatio4)
    total_data.append(ave_CompRatio5)
    total_data.append(ave_CompRatio6)
    total_data.append(ave_CompRatio7)
    total_data.append(ave_CompRatio8)
    total_data.append(ave_CompRatio9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Ave CompRatio",np_total_data.mean(axis = 0))


def GetworstCompRatio():
    worst_CompRatio0 = [0.8188760806916426, 0.9690312569275106, 0.9751052981600532, 0.8165595211704721, 0.969164265129683, 0.969164265129683, 0.9659055641764576, 0.9401906450897806, 0.9554422522722235, 0.8186211483041455, 0.41387718909332744, 0.41254710707160275]
    worst_CompRatio1 = [0.8167003156685368, 0.9600673723661755, 0.9757838730187058, 0.860113105263745, 0.9657560986492064, 0.9657560986492064, 0.9739657114811882, 0.962833654950865, 0.97412187259484, 0.8721709741107182, 0.5049469609931847, 0.5076240086557875]
    worst_CompRatio2 = [0.7927298853800644, 0.7726012326414226, 0.8871987157178621, 0.8708869854171111, 0.8394871852442269, 0.8394871852442269, 0.9028256452282857, 0.7338033386845089, 0.9012427450408074, 0.8229733825791169, 0.6531764653052977, 0.6531764653052977]
    worst_CompRatio3 = [0.794970427358029, 0.9780206341441722, 0.9920843153822209, 0.8552052296882643, 0.9719393427313558, 0.9719393427313558, 0.9844910392671321, 0.9646462400498066, 0.9843131587139236, 0.8386623382398719, 0.36605594343398407, 0.36605594343398407]
    worst_CompRatio4 = [0.8678522662936691, 0.8612137964720641, 0.9387329181514414, 0.8862468223043705, 0.9290194380613004, 0.9290194380613004, 0.9415637037777111, 0.8667643565235732, 0.9426072090673949, 0.8302416713846427, 0.49122456455856395, 0.49095813767609153]
    worst_CompRatio5 = [0.7052395660270062, 0.8989998104434508, 0.9320495523120323, 0.8586019646978803, 0.9209437686072054, 0.9209549189924512, 0.929250805615334, 0.8244706354604552, 0.9336440574021833, 0.8039539266081643, 0.6643845544863575, 0.6643845544863575]
    worst_CompRatio6 = [0.7266420813563895, 0.8813384003058172, 0.8897146454993141, 0.8878932337928088, 0.8905354050954555, 0.8905354050954555, 0.8959434238042769, 0.7889748375345731, 0.898090890692811, 0.8765937352431922, 0.7082255852128353, 0.7082255852128353]
    worst_CompRatio7 = [0.6871521597079832, 0.8050629774002388, 0.7876230819494829, 0.8249814109641513, 0.822187422545684, 0.822187422545684, 0.827910592370609, 0.7256145647912395, 0.8427254906378856, 0.7335571528356729, 0.5905905680358712, 0.5905905680358712]
    worst_CompRatio8 = [0.7506692625943052, 0.8392331688754175, 0.8756609659505741, 0.837507466979358, 0.8614902984579305, 0.8614902984579305, 0.8614902984579305, 0.8156485762959358, 0.8657271178565897, 0.8380827009447112, 0.5302661563308922, 0.5347574061373039]
    worst_CompRatio9 = [0.7372043492881963, 0.9177558569667078, 0.9472704853715951, 0.8842282255352539, 0.9462280013451407, 0.9462280013451407, 0.9493330344131824, 0.9015917498038336, 0.9376863580316108, 0.8722901020065015, 0.5808765833426746, 0.5783544445689945]
    
    total_data = []
    total_data.append(worst_CompRatio0)
    total_data.append(worst_CompRatio1)
    total_data.append(worst_CompRatio2)
    total_data.append(worst_CompRatio3)
    total_data.append(worst_CompRatio4)
    total_data.append(worst_CompRatio5)
    total_data.append(worst_CompRatio6)
    total_data.append(worst_CompRatio7)
    total_data.append(worst_CompRatio8)
    total_data.append(worst_CompRatio9)

    np_total_data = np.array(total_data)
    print(np_total_data)
    print()
    print("Worst CompRatio",np_total_data.min(axis = 0))


if __name__ == "__main__":
    GetAveMiss()
    GetWorstMiss()
    GetAveCR()
    GetAveUsys()
    GetWorstUsys()
    GetAveCompRatio()
    GetworstCompRatio()

